#!/usr/bin/env python
"""Setup file for Ubiqis."""

import pprint
import distribute_setup
distribute_setup.use_setuptools()

import os
import subprocess
from setuptools import setup, find_packages
from setuptools.command.install import install as _install

class install(_install):
    """ Subclass setuptools install and add some pre/post install methods """
    def pre_install(self):
        pass

    def post_install(self):
        path = os.path.abspath(os.path.dirname(__file__))
        cmd = path + '/src/bin/post_install.sh'
        os.environ['PREFIX'] = self.prefix
        subprocess.call(cmd)

    def run(self):
        self.pre_install()
        _install.do_egg_install(self)
        self.post_install()

setup(
    name='ubiqis',
    version='0.1dev',
    cmdclass={
      'install': install,
    },
    packages=find_packages('src', exclude='src/tests'),
    package_dir={
        '': 'src',
    },
    py_modules=[
        'uroot',
    ],
    install_requires=[
        'fuse-python>=0.2',
        'pyasn1>=0.0.6a',
        'pycrypto>=2.0.1',
    ],
    include_package_data=True,
    scripts=[
        'src/bin/ubiqfs',
        'src/bin/ubig++',
        'src/bin/ubipkg',
        'src/bin/ubiload',
    ],
    entry_points={
        'console_scripts': [
            'ubimake = ubiqis.ubimake:make'
        ],
    },
    test_suite='tests.run_tests',
    zip_safe=False,

    # metadata for PyPI
    author='Steven R. Brandt',
    author_email='sbrandt@cct.lsu.edu',
    description='UBIQIS package system',
    url='http://ubiqis.com/',
)
